const sqlite3 = require('sqlite3').verbose();

// 连接数据库
const db = new sqlite3.Database('account.db', (err) => {
  if (err) {
    console.error(err.message);
  }
  console.log('Connected to the SQLite database......');
});

//创建用户表
db.run(`
  CREATE TABLE IF NOT EXISTS account (
    id INTEGER PRIMARY KEY AUTOINCREMENT, 
    username TEXT NOT NULL UNIQUE, 
    password TEXT NOT NULL,
    root_path TEXT NOT NULL,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP
  )
`);

module.exports = db;